package com.test.websample.pojo;

import jakarta.validation.constraints.Pattern;
import lombok.Data;
import org.springframework.stereotype.Component;

@Data
@Component
public class User {
    private int id;
    @Pattern(regexp = "^[a-zA-Z0-9_]{2,20}$", message = "用户名只能包含数字、字母和下划线", groups = Update.class)
    private String name;
    private int age;
    private boolean isAlive;
    private String password;

    public interface Update {
    }
}
